<?php 
/* 
Proyecto: Sistema Victoria 2.0
Programador: Felipe Guerra
Año: 2015
Flores de tumbabiro ©
*/
$hostname_victoria = "localhost";
$database_victoria = "country";
$username_victoria = "root";
$password_victoria = "";
$victoria = mysql_pconnect($hostname_victoria, $username_victoria, $password_victoria) or trigger_error(mysql_error(),E_USER_ERROR); 
mysql_query("SET NAMES 'utf8'");


$nivel = $_POST['nivel'];
$selected = $_POST['selected'];
$sqlComboDependiente = $_POST['sql'];

mysql_select_db($database_victoria, $victoria );
//$sqlComboDependiente = "
//SELECT
//  id AS ID_1,
//  NAME AS NOMBRE_1
//FROM pais
//WHERE estado = 1
//ORDER BY NOMBRE_1
//";
$rsListar = mysql_query($sqlComboDependiente, $victoria ) or die(mysql_error());
?>
<select name="ID_<?php echo $nivel?>" id="ID_<?php echo $nivel?>" class="validar" onchange="combosDependientes($(this).val(), <?php echo $nivel + 1 ?>)" >
<option value="" >Seleccione</option>
<?php 
while($row_rsListar = mysql_fetch_assoc($rsListar)){
	$seleccionado = ( $selected == $row_rsListar['ID'] ? 'selected="selected"' : '' );
	
?> 
	<option <?php echo $seleccionado ?> value="<?php echo $row_rsListar['ID']?>" ><?php echo $row_rsListar['NOMBRE']?></option>
<?php 
}
?>
</select>



